<?php
class Sb_Model_Base
{
    protected $_dbTable;
    protected $modelName;


    public function __construct()
    {
        $modelNameArr = explode('_', get_class($this));
        $this->modelName = $modelNameArr[count($modelNameArr)-1];
    }

    protected function getDbTable()
    {
        if($this->_dbTable === null){
            $className = 'Sb_Model_DbTable_'.$this->modelName;
            $this->_dbTable = new $className();
        }
        return $this->_dbTable;
    }

    public function featchAll()
    {
        return $this->getDbTable()->featchAll();
    }
    
    public function delete($id)
    {
    	return $this->getDbTable()->delete($id);
    }
}